cmake_minimum_required(VERSION 2.8)

project (test)

set (EXECUTABLE_OUTPUT_PATH ${test_BINARY_DIR}/bin)

set (LINK_LIBRARIES)

if (${PTHREAD_FOUND})
   set (LINK_LIBRARIES ${PTHREAD_LIBRARIES})
   LINK_DIRECTORIES(${GEN_THREAD_LIB_DIR})
   INCLUDE_DIRECTORIES(${PTHREAD_INCLUDE_DIR})
   list (APPEND DEPLIBS "-L${GEN_THREAD_LIB_DIR}" "${GEN_THREAD_LIB_DIR}/libgen_thread.la")
endif()

# add previously built libdashmem
LINK_DIRECTORIES( "../lib" )
set (LINK_LIBRARIES ${LINK_LIBRARIES} "-ldashmem")

if (NOT ANDROID)
  set (LINK_LIBRARIES ${LINK_LIBRARIES})
endif (NOT ANDROID)

#touchapp many2one
set (PROGRAMS test )

foreach (program ${PROGRAMS})
  add_executable (${program} ${program}.c)
  target_link_libraries (${program} ${LINK_LIBRARIES})
endforeach(program)

set_property(TARGET ${PROGRAMS} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)

install (TARGETS ${PROGRAMS}
  RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
